home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 1 Issue 2
/
PDCD-1 - Issue 02.iso
/
_utilities
/
utilities
/
001
/
wimpext
/
SWIs
< prev
next >
Wrap
Text File
|
1993-05-11
|
61KB
|
1,669 lines
WimpExtension SWIs - 2.17
==================
Note: All strings are control-terminated (ie. <32)
All SWIs preserve all registers that are not used to return information
except for R0, which is always corrupted (or used to return
information). The processor status flags are always preserved unless
there is an error.
I have tried to make the icon-handling SWIs 'intelligent' - ie. if you
tell WimpExtension to set an icon (for example) it won't do anything if
it's already set, so it won't flicker.
WimpExtension has two SWI chunks - &45780 and &46380.
SWI &457BF is unused; this is due to a really really stupid bug in
RISC OS.
Brief list:
-------------------------------
WimpExt_Initialise &45780
WimpExt_CloseDown &45781
WimpExt_SlabIcon &45782
WimpExt_Redraw &45783
WimpExt_Action &45784
WimpExt_IconBarSprite &45785
WimpExt_IconBarText &45786
WimpExt_LinkWindows &45787
WimpExt_OpenLinked &45788
WimpExt_CloseLinked &45789
WimpExt_UnLinkWindows &4578A
WimpExt_CurrentTask &4578B
WimpExt_LoadTemplates &4578C
WimpExt_SetIconString &4578D
WimpExt_OpenWindowTop &4578E
WimpExt_SetIcon &4578F
WimpExt_GetIcon &45790
WimpExt_SetNumberIcon &45791
WimpExt_GetNumberIcon &45792
WimpExt_IncNumberIcon &45793
WimpExt_DecNumberIcon &45794
WimpExt_SetPointer &45795
WimpExt_Divide &45796
WimpExt_ColoursMenu &45797
WimpExt_AutoRedraw &45798
WimpExt_CentreWindow &45799
WimpExt_DragIcon &4579A
WimpExt_PutCaretIcon &4579B
WimpExt_OpenDialogue &4579C
WimpExt_CheckWindowOpen &4579D
WimpExt_CopyString &4579E
WimpExt_SetWindowTitle &4579F
WimpExt_SetIconStringN &457A0
WimpExt_FindLeaf &457A1
WimpExt_LimitPointer &457A2
WimpExt_ReleasePointer &457A3
WimpExt_OpenFullSize &457A4
WimpExt_LoadRAMTemplate &457A5
WimpExt_OpenRequester &457A6
WimpExt_CloseRequester &457A7
WimpExt_HideLink &457A8
WimpExt_UnHideLink &457A9
WimpExt_SendHelp &457AA
WimpExt_SendWimpHelp &457AB
WimpExt_CreateMenu &457AC
WimpExt_ReCreateMenu &457AD
WimpExt_ShadeEntry &457AE
WimpExt_TickEntry &457AF
WimpExt_SetIconColour &457B0
WimpExt_ShadeIcon &457B1
WimpExt_PlotSprite &457B2
WimpExt_RedrawDraw &457B3
WimpExt_PrePoll &457B4
WimpExt_SetExtent &457B5
WimpExt_MoveCaret &457B6
WimpExt_GetFontMenu &457B7
WimpExt_DecodeFontMenu &457B8
WimpExt_ControlImmediate &457B9
WimpExt_Heap &457BA
WimpExt_MemCopy &457BB
WimpExt_DataSave &457BC
WimpExt_PlotBorder &457BD
WimpExt_CentreWindowV &457BE
WimpExt_Sort &46380
WimpExt_MemMove &46381
WimpExt_MenuWidth &46382
WimpExt_DataLoad &46383
WimpExt_MoveCaretIcon &46384
WimpExt_DrawOp &46385
WimpExt_SpriteOp &46386
WimpExt_Intersect &46387
WimpExt_BorderOp &46388
WimpExt_ManualLink &46389
WimpExt_MiscOp &4638A
WimpExt_ViewIcon &4638B
WimpExt_SubsituteArgs &4638C
WimpExt_RedirectSprites &4638D
-------------------------------
WimpExt_Initialise &45780
-------------------------------
R0 = 16
R1 = task handle
R2 = features flags
bit meaning
0 Semi-automatic slabbing if set, automatic otherwise
1 Automatically recreate menus if set
2 Task wants to use font menus if set
3 Automatically compact heap once a second if set
4 'Correct' radio icons if set
5 Semi-automatic help if set, automatic otherwise
6 Use alternative parameters for flag-setting SWIs if set
7 Use R0 of WimpExt_SetIconString[N]
8 Automatically call WimpExt_MoveCaret
9 Unset other icons in ESG when setting icons
10 Automatically call WimpExt_ViewIcon after moving caret
11 Don't allow TAB for moving between writeable icons
12-31 reserved; MUST BE 0
Exit:
R0 = WimpExt version number * 100
R2 = pointer to WimpExt's sprite pool
Must be called prior to using any other WimpExt calls. R0 must be 11 on
entry. This is so that WimpExtension can work out what version the program
thinks it is calling (so I can change the functionality of calls later whilst
still retaining backwards-compatibility). R2 holds features flags, for
specifying certain things at start-up. If bit 1 of R2 is set then if the user
selects a menu option with the ADJUST button then the menu will automatically
be recreated when you next call WimpExt_PrePoll (assuming you used
'WimpExt_CreateMenu' to create the menu, that is). If bit 2 of R2 is set then
you are allowed to call WimpExt_GetFontMenu and WimpExt_DecodeFontMenu - you
are NOT allowed to call them if you do not set bit 2. If bit 4 of R2 is set
then the user won't be able to deselect all of a group of radio icons by
clicking adjust on the selected icon.
WimpExt_CloseDown &45781
-------------------------------
R0 = task handle
MUST be called prior to the task exiting.
WimpExt_SlabIcon &45782
-------------------------------
R2 = window handle or 0 for slabbed icon
R3 = icon handle
If semi-automatic slabbing is enabled, then:
R4 = 0 to pop out, any other to pop in
To be called to force an icon to be slabbed (for example to slab the default
action icon if RETURN is pressed). If semi-automatic slabbing is enabled then
the icon will be popped in or out depending on R4, otherwise it will be
popped in and then out again. If R2 is zero then the last icon to be slabbed
in (either implicity or explicity) is used. Note that in this case the SWI
might return an error (eg. if the window has been deleted), so use the X form
of the SWI.
WimpExt_Redraw &45783
-------------------------------
R1 = Wimp_RedrawWindow block
To be called in the window redraw loop, to draw the 3D borders round icons.
WimpExt_Action &45784
-------------------------------
R0 = task handle
R1 = Wimp_Poll block
R2 = Wimp_Poll reason code
Exit:
R0 = Wimp_Poll reason code (possibly altered)
To be called immediately after Wimp_Poll, to perform actions such as slabbing
icons and changing pointers. WimpExtension may alter the code returned - eg.
if the user clicks in a requester window then the code will be translated
before your program gets to see it.
WimpExt_IconBarSprite &45785
-------------------------------
R2 = -2 for left of iconbar, -1 for right
R3 = pointer to sprite name
R5 = icon button type (eg. 3)
Exit:
R0 = icon handle
Will place a sprite on the iconbar, returning the icon handle. Note that the
sprite name is copied out of the memory block, which can be reused. Also note
that the number in R5 is just the button type, not the flags.
WimpExt_IconBarText &45786
-------------------------------
R2 = -2 for left of iconbar, -1 for right
R3 = pointer to sprite name
R4 = pointer to text (max. 128 chars inc. terminator)
R5 = icon button type (eg. 3)
Exit:
R0 = icon handle
Will place a sprite on the iconbar, with a text message underneath, returning
the icon handle. Note that the sprite name is copied out of the memory block,
which can be reused, but the text remains where it is; this is so you can
change the text after creating the icon. Also note that the number in R5 is
just the button type, not the flags.
WimpExt_LinkWindows &45787
-------------------------------
R2 = main window handle
R3 = sub-window handle
R4 = flags
bit meaning
0 clip linked window to the left of the main window
1 clip linked window to the right of the main window
2 clip linked window above the main window
3 clip linked window below the main window
4-30 reserved; MUST BE 0
31 link is hidden
Will link two windows so the sub-window moves with the main window. Currently
there is a limit of 16 linked windows - this may be removed in a later
version.
WimpExt_OpenLinked &45788
-------------------------------
R1 = Wimp_OpenWindow block
To be used instead of Wimp_OpenWindow. It does the same thing, but if the
window is linked then it will handle the link. If the window is not linked,
it has the same effect as Wimp_OpenWindow.
WimpExt_CloseLinked &45789
-------------------------------
R1 = Wimp_CloseWindow block
To be used instead of Wimp_CloseWindow. It does the same thing, but if the
window is linked then it will close the linked window as well. If the window
is not linked, it has the same effect as Wimp_CloseWindow.
WimpExt_UnLinkWindows &4578A
-------------------------------
R2 = main window handle
R3 = sub-window handle
Will remove the link between the specified window and its subwindow. Note
that this just removes the pointer in WimpExtension workspace, if the windows
are on the screen they will remain there. You do not have to call
UnLinkWindows before you exit - it is here so that you can unlink windows
while your application is still running.
WimpExt_CurrentTask &4578B
-------------------------------
R0 = task handle
Exit:
R0 = previous task handle
Informs WimpExtension which task is currently active. Not needed if you have
called WimpExt_Initialise or WimpExt_Action since the last Wimp_Poll. The
previous user is returned in R0.
WimpExt_LoadTemplates &4578C
-------------------------------
R0 = pointer to buffer for storing window handles
R1 = pointer to user buffer for template (big enough for largest template)
R2 = pointer to workspace for indirected icons
R3 = pointer to end of workspace for indirected icons
R4 = 256-byte font reference array (-1 for no fonts)
R5 = pointer to filename of templates file
R6 = pointer to sprite area control block (+1 for Wimp sprite pool)
Loads in all the templates from the file whose name is pointed to by R5, and
called Wimp_CreateWindow for each one. The value in R6 is placed in the
window block at offset +64. Stores the window handles sequentially in the
buffer pointed to by R0, in the order they are found in the templates file.
On exit the buffer pointed to by R1 will contain the template for the last
window in the file. The buffer for window handles should be big enough to
store all the window handles, each of which is a word. For each window, if
the word on entry is zero the window will be created as usual. Bits that are
set have the following meanings:
Bit Meaning if set
----------------------------------------------
0 centre window horizontally
1 don't create window
2 centre window vertically
Bit 1 is useful if you have the last window in the file as one that you want
repeatedly, but you don't want it created at once.
WimpExt_SetIconString &4578D
-------------------------------
R0 = non-zero for ellipsis (only if enabled in WimpExt_Initialise)
R2 = window handle
R3 = icon handle
R4 = pointer to string
Copies the string pointed to by R2 into the specified indirected text icon,
and updates the screen if necessary. If the caret was in the icon then it is
moved to the end of the new string. Only updates the screen if anything was
changed - ie. if the new string is the same as the old string then nothing
will happen. If R0 is non-zero and bit 7 was set in R2 in WimpExt_Initialise
and the string is longer than the icon can hold then the string will be
post-fixed with '...'.
WimpExt_OpenWindowTop &4578E
-------------------------------
R0 = window handle
Opens the window whose handle is in R0, or brings it to the top if it is
already open. If the 'Back' attribute is set then it opens it at the back
instead. Calls WimpExt_OpenLinked, so linked windows are handled correctly.
WimpExt_SetIcon &4578F
-------------------------------
R2 = window handle
R3 = icon handle
R4 = 0 to deselect icon, non-zero to select icon
If bit 6 of R2 was set in WimpExt_Initialise:
R4 = 0 to deselect icon, 1 to select icon, 2 to toggle icon
Exit:
R0 = old state of icon (0 for unset, 1 for set)
Selects the icon if R4 is non-zero, deselects it otherwise. Updates the
screen if necessary. If bit 6 of R2 was set in WimpExt_Initialise then the
alternative parameters are used as shown. If bit 9 of R2 was set in
WimpExt_Initialise and you are setting the icon, then other icons in the same
ESG will be unset.
WimpExt_GetIcon &45790
-------------------------------
R2 = window handle
R3 = icon handle
Exit:
R0 = 0 if icon is not selected, 1 if it is selected
R3 = Word at iconblock+20 (ie. pointer to indirected text for indirected text
icon)
Detects whether the icon is selected, and returns 1 in R0 if it is, 0
otherwise. Also returns in R3 the value in the iconblock at offset 20. For an
indirected text icon this will be a pointer to the text.
WimpExt_SetNumberIcon &45791
-------------------------------
R0 = base
R2 = window handle
R3 = icon handle
R4 = value
Converts the signed integer in R4 into a string and places it in the icon.
Updates the screen as necessary. The base to be used is specified in R0 - it
must be in the range 2-36.
WimpExt_GetNumberIcon &45792
-------------------------------
R0 = default base
R2 = window handle
R3 = icon handle
Exit:
R0 = value
Converts the string in the icon to a signed integer and places it in R0. The
base to be used by default is specified in R0 - it must be in the range 2-36.
WimpExt_IncNumberIcon &45793
-------------------------------
R0 = base
R2 = window handle
R3 = icon handle
R4 = maximum value
R5 = step
Exit:
R0 = new value
Converts the string in the icon to an signed integer, adds the step, and puts
it back. Updates the screen as necessary. The value will not go beyond the
value passed in R4, and the new value is returned in R0.
WimpExt_DecNumberIcon &45794
-------------------------------
R0 = base
R2 = window handle
R3 = icon handle
R4 = minimum value
R5 = step
Exit:
R0 = new value
Converts the string in the icon to an signed integer, subtracts the step, and
puts it back. Updates the screen as necessary. The value will not go beyond
the value passed in R4, and the new value is returned in R0.
WimpExt_SetPointer &45795
-------------------------------
R0 = pointer to sprite name in the Wimp sprite pool, or 0 to reset pointer
If R0>=&8000:
R2 = hotspot X
R3 = hotspot Y
Stores the old pointer palette, and changes the pointer palette and shape to
the sprite specified in R0 (palette optional). The 'hotspot' is defined by
the X and Y coordinates (pixels) in R2 and R3. If R0 is <&8000 then it will
reset the pointer to its original state. You don't need to check if the
pointer is already reset or changed as WimpExtension will do this for you.
Note that the pointer will keep changed until you specifically ask for it to
be reset - ie. pointer changes over icons will be suspended, and the pointer
will remain changed outside your window's workarea.
WimpExt_Divide &45796
-------------------------------
R2 = numerator
R3 = denominator
Exit:
R0 = result
R2 = remainder
Returns (R2 DIV R3) in R0 and (R2 MOD R3) in R2. Useful for calculating which
area of window needs to be updated. An error is produced if R3 is zero on
entry.
WimpExt_ColoursMenu &45797
-------------------------------
R0 = colour to be ticked
R2 = 0 to have just colours, 1 to have extra option
Exit:
R0 = pointer to colour menu
Creates a colour menu (like Edit's 'Background' and 'Foreground' ones),
making the text of each option black or white depending on the brightness of
that colour in the current palette. If the value in R0 on entry is in the
range 0-15 then that colour will be ticked in the menu. The call returns a
pointer to the menu block (in RMA workspace). If the value in R2 on entry is
1 then a 17th option will be added, 'Transparent'. You can change the text of
this by changing the menu block if you want (it's in RMA). The 17th option
will be ticked if R0 on entry is 16.
WimpExt_AutoRedraw &45798
-------------------------------
R1 = Wimp_Poll reason code 1 block
This call can be used instead of the normal Wimp_RedrawWindow/GetRectangle
loop if the window doesn't contain any graphics drawn by your program. It
does the equivalent of:
SYS "Wimp_RedrawWindow",,q% TO flag%
WHILE flag%
SYS "WimpExt_Redraw",,q%
SYS "Wimp_GetRectangle",,q% TO flag%
ENDWHILE
WimpExt_CentreWindow &45799
-------------------------------
R1 = pointer to block:
R1 + 0 visible area minimum x coordinate
R1 + 4 visible area minimum y coordinate
R1 + 8 visible area maximum x coordinate
R1 + 12 visible area maximum y coordinate
R1 + 28 window flags
Exit:
Block contains altered coordinates
This call shifts the x coordinates in the supplied block so that the window
described would be centred horizontally on the screen. You can use this call
before Wimp_CreateWindow - eg:
SYS "WimpExt_CentreWindow",,q%
SYS "WimpExt_CreateWindow",,q% TO handle%
or you can use it before Wimp_OpenWindow - eg:
SYS "WimpExt_CentreWindow",,q%+4
SYS "WimpExt_OpenWindow",,q%
If you are using WimpExt_LoadTemplates then windows can be centred
automatically for you (see description above).
WimpExt_DragIcon &4579A
-------------------------------
R0 = flags:
0-1 Horizontal position:
00 = left
01 = middle
10 = right
11 = undefined
2-3 Vertical position:
00 = bottom
01 = middle
10 = top
11 = undefined
4-5 Mouse bounding box:
00 = whole screen
01 = constrain to parent window
10 = constrain to box pointed to by R5
11 = undefined
6 constrain sprite if set, otherwise constrain pointer
7 shadow if set
8 use DragASprite even if CMOS flag isn't set
9-31 reserved; MUST BE 0
R1 = pointer to sprite block, +1 for Wimp sprite area, 0 to use dash box
R2 = window handle
R3 = icon handle
R4 = pointer to sprite name (if R1<>0)
R5 = pointer to mouse bounding box (only if necessary - see flags)
+00 xmin
+04 ymin
+08 xmax
+12 ymax
This SWI does one of two things. If the DragASprite module is loaded, and
bit 1 of byte 28 of the CMOS RAM is set, and R1<>0 then it will use the
DragASprite module as follows:
Work out the parameters to 'DragASprite_Start' and call it. If this
produces an error then try again with dash box as described below.
Otherwise it makes an ordinary rotating dash box as follows:
Work out the parameters to 'Wimp_DragBox' and call it. Bits 0-3 and 7 of
the flags are ignored.
If you are using this SWI at any time with R1<>0 then remember to call
XDragASprite_Stop at appropriate points. You MUST use the X form of the SWI,
and you must ignore errors.
WimpExt_PutCaretIcon &4579B
-------------------------------
R2 = window handle
R3 = icon handle
Works out the length of the text icon specified and calls
Wimp_SetCaretPosition to position the caret at the end of the string.
WimpExt_OpenDialogue &4579C
-------------------------------
R2 = window handle
R3 = X Offset
R4 = Y Offset
Opens the specified window using Wimp_CreateMenu at the pointer position,
offset by R3 and R4. The coordinates used are PointerX-R3,PointerY+R4.
WimpExt_CheckWindowOpen &4579D
-------------------------------
R0 = window handle (or -3 for requester window)
Exit:
R0 = 0 if window closed, 1 if open
Checks to see if the specified window is open.
WimpExt_CopyString &4579E
-------------------------------
R2 = 'from' pointer
R3 = 'to' pointer
Copies the control-terminated string from R2 to R3. The string stored at R3
will be zero-terminated whatever the terminator was for the original string.
WimpExt_SetWindowTitle &4579F
-------------------------------
R2 = window handle
R3 = pointer to string
Copies the string in R3 into the window whose handle is in R2. The title must
be indirected. Updates the screen if necessary.
WimpExt_SetIconStringN &457A0
-------------------------------
R0 = non-zero for ellipsis (only if enabled in WimpExt_Initialise)
R2 = window handle
R3 = icon handle
R4 = pointer to string
Copies the string pointed to by R2 into the specified indirected text icon,
and updates the screen if necessary. If the string is longer than the size of
the buffer then the right-hand end of the string is copied (as opposed to the
left-hand end, which is the case if you use WimpExt_SetIconString). If the
caret was in the icon then it is moved to the end of the new string. If R0 is
non-zero and bit 7 was set in R2 in WimpExt_Initialise and the string is
longer than the icon can hold then the string will be pre-fixed with '...'.
WimpExt_FindLeaf &457A1
-------------------------------
R0 = pointer to pathname
Exit:
R0 = pointer to leafname
Finds the last occurence of '.' in the string pointed to by R0, and returns a
pointer to the next character. eg. given 'scsi::HardDisc.$.first.second.last'
it will return a pointer to 'last'. This can be useful for both extracting
the leaf name, and for determining what directory the file is in (by poking
a zero to (R0-1) - eg. MOV R2,#0 STRB R2,[R0,#-1] ).
WimpExt_LimitPointer &457A2
-------------------------------
R0 = window handle
Limits the mouse pointer to the visible area of the window specified. Note
that if there are draggable objects within this area and these are used then
the mouse rectangle is reset. It is also reset if there is a change of mode,
eg. if the user presses F12 and then Return.
WimpExt_ReleasePointer &457A3
-------------------------------
Releases the limits on the mouse pointer - ie. sets the mouse rectangle to be
the entire screen. Note that this call resets the graphics origin and the
graphics and text windows (ie. it does a 'VDU 26').
WimpExt_OpenFullSize &457A4
-------------------------------
R2 = window handle
R3 = window to open behind (-1 = top, -2 = bottom)
Opens the window to maximum size - ie. the same as clicking on the toggle
icon.
WimpExt_LoadRAMTemplate &457A5
-------------------------------
R1 = pointer to user buffer for window definition
R2 = pointer to workspace for indirected icons
R3 = pointer to end of workspace for indirected icons
R4 = -1 for no fonts - fonts not supported at present
R5 = pointer to template
Exit:
R2 = pointer to end of workspace used (ie. first free byte)
This call is similar to Wimp_LoadTemplate except that it uses templates in
RAM. This is designed to be used in Module tasks, where you cannot have a
separate Templates file. You would use the supplied 'FNtemplate' function to
insert the template in your module, and then call WimpExt_LoadRAMTemplate to
convert this to a window definition. At present fonts in templates are not
supported - this may be fixed in a later version.
WimpExt_OpenRequester &457A6
-------------------------------
R2 = title (eg. 'Message from MyTask')
R3 = text (eg. 'Document not saved. Save?')
R4 = pointer to block containing button definitons
Text for default button (eg. 'Save')
Text for button 1 (eg. 'Discard')
Text for button 2 (eg. 'Cancel')
...
R5 = button to be used if 'Escape' is pressed (0-3)
Opens a requester box with a title, a message and some buttons along the
right-hand edge. The pointer is constrained to the requester window. The
buttons may contain any text up to 8 characters. You can have up to 4
buttons. They are filled with the text specified from the bottom one (the
default) upwards. If the text for a button is a null string then that button
will not be created. If the user presses Return then the default button is
pressed. If the user presses Escape then the button specified in R5 is
pressed. Mouse_Click events to the requester window will be passed from
WimpExt_Action filtered so that only Select and Adjust are passed through,
the window handle is -3, and the icon handle will be 0-3. You can check
whether the requester window is open by using WimpExt_CheckWindowOpen.
WimpExt_CloseRequester &457A7
-------------------------------
Closes the requester window and releases the mouse pointer. This is done
automatically if the user selects a button in the requester box, or presses
Escape or Return. If the window wasn't open then no error is generated.
WimpExt_HideLink &457A8
-------------------------------
R0 = main window handle
R2 = sub-window handle
Temporarily hides the link between the specified window and its sub-window.
This is useful, for example, for removing toolboxes in such a way that they
can be replaced later. Note that this call does no screen update - ie. the
sub-window remains where it is.
WimpExt_UnHideLink &457A9
-------------------------------
R0 = main window handle
R2 = sub-window handle
Unhides the previously hidden link. Note that this call does no screen
update - ie. the sub-window remains where it is.
WimpExt_SendHelp &457AA
-------------------------------
R0 = message text
R1 = pointer to message block containing message of type &502
Sends a reply to message type &502, with the specified text. The message will
appear in Help's Interactive Help Window, or WimpHelp's Standard Help Window.
WimpExt_SendWimpHelp &457AB
-------------------------------
R2 = keyword
R3 = filename
Sends a message to WimpHelp, telling it to open a hypertext help window from
a file as specified in R3, with the keyword as specified in R2.
WimpExt_CreateMenu &457AC
-------------------------------
R1 = pointer to menu structure, or window handle, or -1 to close menus
R2 = menu X
R3 = menu Y
Exactly the same as Wimp_CreateMenu, except that the parameters are stored so
that, after you have processed the selection, if the user clicked ADJUST you
can call WimpExt_ReCreateMenu (see below) to reopen the menu, or this can be
done for you (see WimpExt_Initialise).
WimpExt_ReCreateMenu &457AD
-------------------------------
Reopens the last menu opened with WimpExt_CreateMenu. Generates an error if
the last operation was to close a menu, or if you have not called
WimpExt_CreateMenu yet.
WimpExt_ShadeEntry &457AE
-------------------------------
R1 = pointer to menu structure
R2 = number of option to shade/unshade (0...nn)
R3 = 0 to unshade, any other to shade
If bit 6 of R2 was set in WimpExt_Initialise:
R3 = 0 to unshade entry, 1 to shade entry, 2 to toggle shade flag
Exit:
R0 = old state of menu entry (0 for unshaded, 1 for shaded)
Shades or unshades the specified menu entry. If bit 6 of R2 was set in
WimpExt_Initialise then the alternative parameters are used as shown.
WimpExt_TickEntry &457AF
-------------------------------
R1 = pointer to menu structure
R2 = number of option to tick/untick (0...nn)
R3 = 0 to untick, any other to tick
If bit 6 of R2 was set in WimpExt_Initialise:
R3 = 0 to untick entry, 1 to tick entry, 2 to toggle tick flag
Exit:
R0 = old state of menu entry (0 for unticked, 1 for ticked)
Ticks or unticks the specified menu entry. If bit 6 of R2 was set in
WimpExt_Initialise then the alternative parameters are used as shown.
WimpExt_SetIconColour &457B0
-------------------------------
R2 = window handle
R3 = icon handle
R4 = foreground colour (0-15 or -1 to keep the same)
R5 = background colour (0-15 or -1 to keep the same)
Exit:
R0 = old foreground colour + old background colour * 16
Changes the specified icon's colour(s). If there is no change then the icon
is not updated (ie. it doesn't flicker). This call will now work for anti-
aliased fonts, but the icon MUST have an 'F' validation command, as the Wimp
needs this to specify the icon's colour.
WimpExt_ShadeIcon &457B1
-------------------------------
R2 = window handle
R3 = icon handle
R4 = 0 to unshade icon, non-zero to shade icon
If bit 6 of R2 was set in WimpExt_Initialise:
R4 = 0 to unshade icon, 1 to shade icon, 2 to toggle shade flag
Exit:
R0 = old state of icon (0 for unshaded, 1 for shaded)
Shades the icon if R2 is non-zero, unshades it otherwise. Updates the screen
if necessary. If the caret was in the icon and you are telling WimpExtension
to shade it then the caret is removed (disowned). If bit 6 of R2 was set in
WimpExt_Initialise then the alternative parameters are used as shown.
WimpExt_PlotSprite &457B2
-------------------------------
This SWI has been replaced by SWI WimpExt_SpriteOp 0. This call will still be
supported - it just passes the call on to WimpExt_SpriteOp.
WimpExt_RedrawDraw &457B3
-------------------------------
This SWI has been replaced by SWI WimpExt_DrawOp 0, which is a lot better at
displaying draw files than this one. This call will still be supported, but
if you have written a program using it you are strongly recommended to change
to WimpExt_DrawOp.
WimpExt_PrePoll &457B4
-------------------------------
To be called immediately before Wimp_Poll or Wimp_PollIdle.
WimpExt_SetExtent &457B5
-------------------------------
R0 = window handle
R1 = pointer to block
R1+00 = New work area minimum x
R1+04 = New work area minimum y
R1+08 = New work area maximum x
R1+12 = New work area maximum y
Sets the work area extent of the specified window, altering the values to be
whole pixels, and reopening the window (if already open) so that the change
is reflected on the screen.
WimpExt_MoveCaret &457B6
-------------------------------
R0 = key
R2 = window handle
R3 = icon handle
Exit:
R0 preserved if no action taken, 0 otherwise
Moves the caret from its current writeable icon to the next one above or
below (in number) if the key in R0 is up arrow or down arrow. If you set bit
8 of R2 on entry to WimpExt_Initialise then this SWI will be called
automatically for you in WimpExt_Action, and the reason code translated to a
null event if the key is processed.
WimpExt_GetFontMenu &457B7
-------------------------------
R0 = 0 to unshade 'System font' entry, 1 to shade it
R1 = pointer to menu title (12 chars max), or 0 for default title ('Font')
Exit:
R1 = pointer to menu structure
Reads in the list of fonts currently available and creates a hierarchial
menu structure with all the fonts listed by family. 'System font' is also on
the root menu. This menu structure is guaranteed to remain in the same place
for as long as your task is active. The font list MAY be read in the first
time you call WimpExt_GetFontMenu, or it may have been read in earlier. This
SWI may only be called if you set bit 2 of R2 when you called
WimpExt_Initialise.
WimpExt_DecodeFontMenu &457B8
-------------------------------
R0 = pointer to buffer for font name
R1 = pointer to Wimp_Poll block, reason code Menu_Selection
The font menu is decoded and the correct font name is placed in the buffer.
If the user selects, for example, 'Trinity' of 'Trinity.xxx','Trinity.yyy'
the submenus will be followed through, and the font name at the top of each
menu used. This SWI may only be called if you set bit 2 of R2 when you called
WimpExt_Initialise.
WimpExt_ControlImmediate &457B9
-------------------------------
R1 = 0 or -1 : Close immediate window
= 1 : Check for mouse click in immediate window
= 2 : Open immediate requester and wait for mouse click
= 3 : Redraw icon - icon handle in R0
= 4 : Slab icon - icon handle in R0 (-1 to use currently slabbed
icon), R2 = 1 to slab in, 0 to slab out
= 5 : Limit pointer to immediate window
= 6 : Redraw icon's 3D border - icon handle in R0
= 7 : Redraw icon:
R0 = pointer to icon block
R2 = 'Work area' X origin
R3 = 'Work area' Y origin
>= &8000 : Open immediate window using data pointed to by R1
If R1 = 2 then rest of registers as for WimpExt_OpenRequester
Exit:
If R1 = 1 or 2 : R0 = Icon handle of icon clicked on, or -1 for none
This SWI is for using windows like the Wimp_ReportError window that are not
multi-tasking. You can only have one 'immediate window' open at a time, it is
always on top of the window pile, and you MUST NOT call 'Wimp_Poll' while the
immediate window is open.
If R1 is 0 or -1 on entry, the immediate window is closed. If it was not open
then no error is generated.
If R1 is 1 on entry, then the program will check for mouse clicks on icons in
the window. 3D icons will be slabbed automatically. -1 is returned if no iconwas clicked on.
If R1 is 2 on entry, the rest of the registers are as for
WimpExt_OpenRequester. It opens an 'immediate requester' and waits for a
mouse click on one of the action buttons, or ESCAPE or RETURN. The icon
clicked on is returned in R0.
If R1 is 3 on entry, the icon in the immediate window whose handle is in R0
will be redrawn (presumably because you have changed the indirected data).
The 3D border is not redrawn.
If R1 is 4 on entry, the icon whose handle is in R0 will be slabbed in or out
depending on R2 - similar to WimpExt_SlabIcon for normal icons. If the
specified icon handle is -1 and R2 is 0 then the currently slabbed icon (if
any) is used.
If R1 is 5, the mouse rectangle is redefined to be the size of the immediate
window - similar to WimpExt_LimitPointer for normal windows. Use
WimpExt_ReleasePointer to release the pointer again afterwards.
If R1 is 6, the specified icon's 3D border is redrawn.
If R1 is 7, the specified icon is drawn. You do not need to have an immediate
window open to use this reason code.
If R1 is greater than or equal to &8000 on entry, then an immediate window is
created from the Wimp_CreateWindow block pointed to by R1.
If you call WimpExt_PrePoll while an immediate window is open then it will be
closed automatically - the Wimp does not know about immediate windows and the
screen display would become corrupted if you kept an immediate window open
over a call to Wimp_Poll[Idle].
Icon types currently supported are:
sprite-only non-indirected
text-only, all types
Unknown icon types will be ignored.
WimpExt_Heap &457BA
-------------------------------
R0 = reason code
other registers as appropriate for reason code
This SWI provides access to a heap management system. Access to blocks is
provided via 'anchors'. When calling WimpExt_Heap routines, you can either
refer to a block by a pointer to it, or by a pointer to its anchor. I will
refer to this as a 'block pointer'. The anchor contains the address of the
block. This address may change on calls to WimpExt_Heap as the blocks are
shuffled around, but the anchor will always stay fixed. The size of the block
is stored 4 bytes before the start of the block.
eg. to find the size of a block from its anchor:
size%=!((!anchor%)-4)
All these calls can return the errors 'Heap corrupt' or 'Bad heap operation'.
All the calls act on the currently selected heap. The heap can be selected
using R0=14.
R0 = 0 - Initialise standard heap:
----------------------------------
R1 = pointer to base of heap
R2 = number of anchors to allocate
Initialises the standard heap. R1 points to the base of the heap - it will
grow upwards from here. R2 specifies the numbers of anchors to allocate
initially. Each anchor takes 8 bytes. Note that R1 is rounded up to the
nearest multiple of 8 plus 4 (ie. 8N+4). The heap is automatically selected
as the current heap.
R0 = 1 - Describe heap:
-----------------------
Exit:
R0 = currently selected heap pointer, or +1 for standard heap
R2 = largest available block size
R3 = total free
R4 = memory used by heap
R5 = number of anchors allocated
R6 = number of anchors in use
Adds up all the sizes of the free blocks, and returns information about
memory used by the heap. If the heap is empty then R2-R6 will be zero.
R0 = 2 - Allocate block:
------------------------
R2 = size of block required
Exit:
R1 = pointer to anchor or zero if allocation failed
Tries to find a block of the required size. Increases the WimpSlot if
necessary. If a call to Wimp_SlotSize fails then zero will be returned. Note
that the size is rounded up to the next multiple of 8 plus 4.
R0 = 3 - Free block:
--------------------
R1 = block pointer
Frees the memory used by the specified block.
R0 = 4 - Reallocate block:
--------------------------
R1 = block pointer
R2 = new size required
Exit:
R1 = pointer to anchor (the same anchor as before) or 0 if reallocate failed
Tries to resize the specified block. You should check R1 on exit to see if
the resize was successful (only on increasing the size, decreasing the size
will always be successful).
R0 = 5 - Tidy heap:
-------------------
Tries to tidy the heap, reducing the WimpSlot if possible. This can be
automatically performed once a second (in WimpExt_PrePoll) if you set bit 3
of R2 when you called WimpExt_Initialise. Note that this routine does not
tidy the heap fully, it just does a little bit each time it is called. This
is to keep the time cost down.
R0 = 6 - Compact heap:
----------------------
Repeatedly calls Tidy Heap, until the heap is as small as it can get.
R0 = 7 - Find anchor:
---------------------
R1 = block pointer
Exit:
R1 = pointer to anchor
Given a block pointer, returns a pointer to that block's anchor.
R0 = 8 - Fix blocks:
--------------------
Fixes the heap. Subsequent calls to the Tidy or Compact routines will have no
effect. Effectively, the heap becomes a non-relocatable heap like the RMA.
This call is provided so that if you temporarily need to rely on the blocks
not moving, you can easily do so. WimpExtension keeps a counter of the number
of times you call this routine, so that if you, for example, fix the blocks
twice in a row then you need to unfix them twice in a row before they are
actually unfixed.
R0 = 9 - Unfix blocks regardless of counter:
--------------------------------------------
Unfixes the heap, so that garbage disposal routines will work again. This
call zeroes the counter straight away - ie. the blocks are immediately
unfixed no matter how many times you called the fix routine.
R0 = 10 - Unfix blocks:
-----------------------
Unfixes the heap, so that garbage disposal routines will work again. This
routine decrements the fix counter, and only actually unfixes the blocks if
the counter reaches zero.
R0 = 11 - Increase anchors:
---------------------------
R2 = number of anchors to add
Exit:
R1 = 0 indicates failure, non-zero indicates success
Increases the number of anchors. This routine is quite slow as it often has
to move the entire heap up in memory so you should use this routine
sparingly, if you need to use it at all. Note that this SWI causes blocks to
be relocated.
R0 = 12 - Allocate with anchor extend:
--------------------------------------
R2 = size of block required
Exit:
R1 = pointer to anchor or zero if allocation failed
Tries to find a block of the required size. Increases the WimpSlot if
necessary. If a call to Wimp_SlotSize fails then zero will be returned. Note
that the size is rounded up to the next multiple of 8 plus 4. If no free
anchors are available then the increase anchors call is used to make some
more; therefore using this SWI can cause blocks to be relocated. It is,
however, the recommended call to use for allocating blocks as it isn't
limited by the number of anchors already created.
R0 = 13 - Free all blocks
-------------------------
Frees all blocks in the currently selected heap belonging to your task.
R0 = 14 - Select heap
---------------------
R1 = heap pointer, or +1 for standard heap, or -1 for no change
Exit:
R0 = previous heap pointer, or 0 if no previously selected heap
R1 = current heap pointer, or 0 if no currently selected heap
Selects a new heap to be used by the other WimpExt_Heap calls.
R0 = 15 - Relocate heap
-----------------------
Compares the heap addresses specified by hp_base and hp_rootptr. If they are
different, then hp_base is updated by hp_rootptr, and the anchors are
recalculated to account for the change of address.
R0 = 16 - Create a heap in a heap block
---------------------------------------
R1 = heap pointer (blank, it will be filled in by this call)
R2 = number of anchors to create
Exit:
R1 = heap pointer, or 0 if the call failed due to lack of memory
This call creates a new heap inside a heap block in the currently selected
heap. The new heap is NOT selected as the current heap.
WimpExt_MemCopy &457BB
-------------------------------
R0 = 'from' address (word aligned)
R1 = 'to' address (word aligned)
R2 = length (not necessarily word aligned)
Exit:
R0 preserved
Copies an area of memory very quickly. Can cope with overlap, R0=R1 or R2=0.
WimpExt_DataSave &457BC
-------------------------------
R0 = file length
R1 = pointer to filename (pathname or leafname)
R2 = file type
R3 = pointer to data
R4 = zero to allow files to be saved to your own task, non-zero otherwise
R5 = pointer to Wimp_GetPointerInfo block if >=&8000, otherwise file will be
saved to current mouse position
Exit:
R0 = 0 if failed due to attempt to save to own task, non-zero otherwise
Used to save a file from your program to a filer or to another task. When you
receive the User_Drag_Box event after the user has dragged the icon to where
they want it put, call WimpExt_DataSave to handle the data transfer. R5
allows you to use this call to save to a specified place - just use R5=0 if
you want to save to the pointer position. If R4 is non-zero on entry, then if
the user has dragged the file to a window or icon belonging to your task then
no action will be taken, and R0 will be zero on exit. Otherwise, when the
transfer has finished, WimpExtension will send you a message, number &45782,
with the word at R1+20 having the following meaning:
0 = file not saved. Error block at R1+24
1 = file saved but is 'unsafe' (eg. saved to another task)
2 = file saved. Filename at R1+24
WimpExt_PlotBorder &457BD
-------------------------------
R0 = reason code
R0 = 0 => R1 = pointer to icon block
R2 = window handle (or -1 for no window)
R0 = 1 => R1 = pointer to block:
R1 + 0 Minimum work area x coordinate
R1 + 4 Minimum work area y coordinate
R1 + 8 Maximum work area x coordinate
R1 + 12 Maximum work area y coordinate
R1 + 16 Border type
R2 = window handle (or -1 for no window)
Like Wimp_PlotIcon, except it just redraws the 3D border. R0 specifies how
the coordinates and border type are to be specified. If bit 31 of R0 is set
then the border will be plotted slabbed in.
WimpExt_CentreWindowV &457BE
-------------------------------
R1 = pointer to block:
R1 + 0 visible area minimum x coordinate
R1 + 4 visible area minimum y coordinate
R1 + 8 visible area maximum x coordinate
R1 + 12 visible area maximum y coordinate
R1 + 28 window flags
Exit:
Block contains altered coordinates
This call shifts the y coordinates in the supplied block so that the window
described would be centred vertically on the screen. You can use this call
before Wimp_CreateWindow - eg:
SYS "WimpExt_CentreWindowV",,q%
SYS "WimpExt_CreateWindow",,q% TO handle%
or you can use it before Wimp_OpenWindow - eg:
SYS "WimpExt_CentreWindowV",,q%+4
SYS "WimpExt_OpenWindow",,q%
If you are using WimpExt_LoadTemplates then windows can be centred
automatically for you (see description above).
WimpExt_Sort &46380
-------------------------------
R0 = number of objects to sort
R1 = pointer to array of objects
R2 = pointer to comparison routine
R3 = workspace pointer for comparison procedure
R4 = size of object
R5 = address of temporary workspace of R4 bytes (only needed if R4>63)
This SWI will sort an array of objects. It is very similar to the OS_HeapSort
SWI, except that you can use it to sort an array of ANY object, rather than
just arrays of pointers. R2 points to a routine which is entered, in SVC
mode, as follows:
R0 = address of object a
R1 = address of object b
R12 = value supplied to WimpExt_Sort in R3
R13 = supervisor stack
R14 = return address
The routine should compare the two objects and return, preserving all
registers apart from R0,R1,R12 and R14, with flags set as follows:
a<b Z=0, C=0
a=b Z=1, C=1
a>b Z=0, C=1
The actual method of sorting is unspecified; suffice it to say it's fast...
Although R5 doesn't have to be word-aligned, the sort will probably be faster
if it is.
WimpExt_MemMove &46381
-------------------------------
R0 = from
R1 = to
R2 = size in bytes
Copies R2 bytes from R0 to R1. R0 and R1 need not be word-aligned, and R2
need not be a multiple of 4. This SWI uses the optimised memory copying
routine given in the RISC OS 2 PRMs. It does not cope with overlap (which is
why it's separate from WimpExt_MemCopy).
WimpExt_MenuWidth &46382
-------------------------------
R1 = pointer to menu structure
This SWI scans through the specified menu, altering its width and the widths
of all its submenus, so that all the menus are the minimum width possible
while still displaying the text correctly (and neatly). This call does not
take account of sprites in menu structures.
WimpExt_DataLoad &46383
-------------------------------
R0 = 0 : Load into heap block
R1 = pointer to DataSave or DataLoad message block
R2 = block pointer of block to receive file, or 0 to create new block
R3 = offset in block to place file
R0 = 1 : Load into fixed block
R1 = pointer to DataSave or DataLoad message block
R2 = pointer to block to receive file
R3 = length of block
Use this SWI to load files from the filer or other applications. If R0=0 then
the file is loaded into a WimpExt_Heap block, and can be any length, memory
permitting. If R0=1 then the file is loaded into a fixed area of memory, and
will not be loaded if it exceeds the length of the area. When you receive the
DataSave or DataLoad message, pass the block onto WimpExt_DataLoad, and the
transfer will be handled automatically. As long as this SWI doesn't return an
error, when the transfer has finished, WimpExtension will send you a message,
number &45784, with the word at R1+20 having the following meaning:
0 = file not loaded. Error block at R1+28
1 = file transferred successfully from another task
2 = file loaded successfully from disc
A pointer to the block's anchor is at R1+24, if it was loaded into a heap
block. Otherwise a pointer to the area is at R1+24. If R1+20<>0 then the rest
of the block contains:
R1+28 = length of file
R1+32 = load address of file
R1+36 = exec address of file
R1+40 = filename (leafname if transferred from task)
Obviously you need to have initialised a heap to use this SWI. Note that
WimpExtension won't free the block if there's an error; your error handler
must do this if appropriate. The load and exec addresses don't indicate the
date if the file was transferred from another task (the relevant bits will
all be zero).
WimpExt_MoveCaretIcon &46384
-------------------------------
R2 = window handle
R3 = icon handle
Moves the caret into the specified icon, keeping its vertical position as
nearly unchanged as possible. If the caret is currently disowned then it is
placed at the end of the string in the icon.
WimpExt_DrawOp &46385
-------------------------------
R0 = reason code
other registers as appropriate for reason code
This SWI performs various operations on Draw files, including rendering them
onto the screen (or printer).
R0 = 0 : Render draw file
-------------------------
R1 = pointer to scaling and position table:
R1+00 = amount to multiply X by * 65536
R1+04 = 0
R1+08 = 0
R1+12 = amount to multiply Y by * 65536
R1+16 = X origin (OS units)
R1+20 = Y origin (OS units)
R2 = pointer to first object (ie. beginning of Draw file+40)
R3 = pointer to end of last object (ie. end of file)
R4 = pointer to graphics clip box, or 0 for no clipping:
R4+00 = XMin
R4+04 = YMin
R4+08 = XMax
R4+12 = YMax
Exit:
F0-F2 corrupted if scaling is not 1:1
This call displays a draw file. Objects will be checked one by one to see if
they are in the clipping area, and redrawn if they are. Currently the
following objects are supported:
0 - font table
1 - text
2 - path
5 - sprite
6 - group
7 - tag
This is all the objects specified in the RISC OS 2 PRMs, except for text AREA
objects, which are hardly ever used and are very very complicated. Magnifying
a draw file by more than about 8 times is probably not a good idea because
rounding errors in the Draw module will start to become significant. Note
that this call requires the ColourTrans module. It also requires the
FPEmulator module, if and only if the scaling is not 1:1. This call replaces
the old SWI WimpExt_RedrawDraw, which should now not be used. (This call is
much better anyway.)
R0 = 1 : Calculate bounding box
-------------------------------
R2 = pointer to first object
R3 = pointer to end of last object
Exit:
R4 = XMin (Draw units)
R5 = YMin (Draw units)
R6 = XMax (Draw units)
R7 = YMax (Draw units)
Calculates the bounding box of the specified objects. The coordinates are
returned in Draw units (which are OS Units * 256). Grouped objects are not
checked individually - the group's bounding box is used. Unknown object types
will not be checked. (This call 'knows' all the types described in the RISC
OS 2 PRMs.) If no objects with bounding boxes are in the set specified then
R4-R7 on exit are undefined.
R0 = 2 : Register unknown object handler
----------------------------------------
R2 = pointer to routine (or 0 for no unknown object handler)
R3 = pointer to workspace
This routine will be called if the Render Draw File code encounters an
unknown object. The routine has the following entry and exit conditions:
Entry: (SVC mode)
R2 = pointer to object
R4 = pointer to scaling and position table
R6 = clipping rectangle XMin (pretransformed)
R7 = clipping rectangle YMin (pretransformed)
R8 = clipping rectangle XMax (pretransformed)
R9 = clipping rectangle YMax (pretransformed)
R12 = your workspace pointer
R13 = pointer to supervisor stack (at least 256 bytes guaranteed)
R14 = return address
Exit:
R1-R11,R13 preserved
V flag set on error, with R0 pointing to standard error block
WimpExt_SpriteOp &46386
-------------------------------
R0 = reason code
+256 for user sprite area, R2 points to sprite name
+512 for user sprite area, R2 points to sprite
unless otherwise specified:
R1 = sprite control block pointer (or +1 for Wimp sprite pool)
R2 = sprite pointer
other registers as appropriate for reason code
This SWI performs various operations on sprites, including displaying them
onto the screen (or printer). Note that these calls need ColourTrans if you
are using them with 256-colour sprites. Sprites in the system sprite area are
not supported.
R0 = 0 : Display sprite
-----------------------
R3 = x coordinate (OS units)
R4 = y coordinate (OS units)
R5 = plot action
Plots the specified sprite on the screen. This call is mode-independent, so
if necessary the sprite is changed size and/or the colours are chosen
appropriately.
R0 = 1 : Get palette
--------------------
Exit:
R3 = pointer to sprite's palette, or 0 if it doesn't have one
R4 = number of entries in palette
Locates the specified sprite's palette.
R0 = 2 : Make pixel translation table
-------------------------------------
R3 = pointer to block to contain table (1 byte per colour)
Exit:
block contains pixel translation data
Calculates a pixel translation table for displaying the specified sprite in
the current mode. If the sprite has no palette then the desktop's colours are
used.
R0 = 3 : Make scaling table
---------------------------
R3 = pointer to 16-byte block to contain table
Exit:
block contains scaling table
Calculates a scaling table for displaying the specified sprite at normal size
in the current mode.
R0 = 4 : Display sprite scaled
------------------------------
R3 = x coordinate (OS units)
R4 = y coordinate (OS units)
R5 = plot action
R6 = pointer to sprite scaling table:
R6 + 00 x multiplier
R6 + 04 y multiplier
R6 + 08 x divisor
R6 + 12 y divisor
Plots the specified sprite on the screen, scaled according to the table. This
call is mode-independent, so if necessary the sprite is changed size and/or
the colours are chosen appropriately. The sprite is first scaled to be the
correct size in the current mode, then the specified scaling table is used.
R0 = 5 : Copy sprite
--------------------
R3 = pointer to destination sprite area (or +1 for Wimp sprite pool)
Copies the specified sprite into the destination sprite area. Gives an error
if there isn't enough room. Note that sprites with duplicate names will NOT
be overwritten; you will end up with two sprites with the same name.
R0 = 6 : Copy sprite area
-------------------------
R1 = source sprite control block pointer (or +1 for Wimp RMA sprite pool,
or +2 for Wimp ROM sprite pool)
R2 = target sprite control block pointer (or +1 for Wimp sprite pool)
Copies ALL the sprites from the source sprite area to the target sprite area.
Gives an error if there isn't enough room. Note that sprites with duplicate
names will NOT be overwritten; you will end up with two sprites with the same
name.
R0 = 7 : Remove duplicate names
-------------------------------
R1 = sprite control block pointer (or +1 for Wimp sprite pool)
Checks for sprites with duplicate names. If any exist, all copies except the
LAST one will be deleted.
R0 = 8 : Copy sprite area sprite by sprite
------------------------------------------
R1 = source sprite control block pointer (or +1 for Wimp RMA sprite pool,
or +2 for Wimp ROM sprite pool)
R2 = target sprite control block pointer (or +1 for Wimp sprite pool)
Copies ALL the sprites from the source sprite area to the target sprite area.
Gives an error if there isn't enough room. The sprites will be copied one by
one, with duplicate sprite names removed before each copy. This means that
this call, while being slower than 'Copy sprite area' followed by 'Remove
duplicate names', often requires less free memory in the target sprite area.
R0 = 9 : Check if sprite needs to be transformed
------------------------------------------------
R3 = mode to check for, or -1 for current mode
Exit:
R0 = bit meaning if set
0 a pixel translation table would be needed
1 a scaling table would be needed
2-31 undefined; will be 0 if the sprite doesn't need transforming
Checks whether the specified sprite needs to be scaled or needs a pixel
translation table to be plotted correctly in the specified mode. If either of
these things are required, other WimpExt_SpriteOp calls exist to calculate
them for you.
R0 = 10 : Global replace
------------------------
R3 = search colour
R4 = replace colour
Replaces all pixels of colour R3 with pixels of colour R4. This routine isn't
very fast, but it works. Currently it won't work with 256-colour sprites.
WimpExt_Intersect &46387
-------------------------------
R0 = 0 : Boxes in registers:
R2 = XMin1
R3 = YMin1
R4 = XMax1
R5 = YMax1
R6 = XMin2
R7 = YMin2
R8 = XMax2
R9 = YMax2
R0 = 1 : Boxes in blocks:
R2 = pointer to XMin1,YMin1,XMax1,YMax1
R3 = pointer to XMin2,YMin2,XMax2,YMax2
Exit:
If boxes intersect:
R0 = 1, C flag set
If boxes don't intersect:
R0 = 0, C flag clear
Checks whether the specified rectangles intersect.
WimpExt_BorderOp &46388
-------------------------------
R0 = reason code
other registers as appropriate for reason code
R0 = 0 : Get border number
--------------------------
R1 = pointer to icon block
Exit:
R0 = border number, or -1 if the icon has no 3D border
Returns the number of the 3D border of the specified icon. -1 is returned if
the icon has no 3D border.
R0 = 1 : Get border width
-------------------------
R2 = border number (0-6)
Exit:
R0 = width in OS units, or 0 if R2 did not contain a valid border number
Returns the width of the 3D border outside the icon's bounding box. 0 is
returned if an invalid border type is specified.
R0 = 2 : Get bounding box in registers
--------------------------------------
R1 = pointer to icon block
Exit:
R2 = XMin
R3 = YMin
R4 = XMax
R5 = YMax
Returns the bounding box of the icon, including the 3D border if present.
R0 = 3 : Get bounding box in block
----------------------------------
R1 = pointer to icon block
R2 = pointer to 16-byte block to receive bounding box
Exit:
R2 + 0 = XMin
R2 + 4 = YMin
R2 + 8 = XMax
R2 + 12 = YMax
Returns the bounding box of the icon, including the 3D border if present.
WimpExt_ManualLink &46389
-------------------------------
R2 = main window handle
R3 = sub-window handle
R4 = flags
bit meaning
0 clip linked window to the left of the main window
1 clip linked window to the right of the main window
2 clip linked window above the main window
3 clip linked window below the main window
4-30 reserved; MUST BE 0
31 link is hidden
R5 = X offset between main and sub-window
R6 = Y offset between main and sub-window
Will link two windows so the sub-window moves with the main window. Currently
there is a limit of 16 linked windows - this may be removed in a later
version.
WimpExt_MiscOp &4638A
-------------------------------
R0 = reason code
other registers as appropriate for reason code
R0 = 0 : Read defaults
----------------------
R1 = pointer to block to read values (64 bytes long)
Exit:
R1 + 0 = top-left colour
R1 + 4 = bottom-right colour
R1 + 8 = in colour
R1 + 12 = channel colour
R1 + 16 = minimum slabbing time
R1 + 20 = sprite style
bit meaning
0 0 = 3D, 1 = flat
1-31 reserved
Reads in the default values as specified by *WimpExt Defaults. The block
should be at least 64 bytes long, to allow room for future expansion.
R0 = 1 : Read window border thickness
-------------------------------------
Exit:
R2 = title thickness (OS Units)
R3 = vertical scrollbar thickness (OS Units)
R4 = horizontal scrollbar thickness (OS Units)
Reads the thickness of the window borders. Needed because on RISC OS 3 Acorn
rather stupidly decided to make it so that you can change their thickness.
WimpExt_ViewIcon &4638B
-------------------------------
R0 = movement type:
0 = scroll window minimum amount necessary
1 = centre icon in window (only if it's currently outside the window)
2 = choose 0 or 1 depending on how far outside the window the icon is
R2 = window handle (or -1 for caret window and icon)
R3 = icon handle (if R2<>-1)
Checks to see if the specified icon is in the portion of the window which is
visible on the screen, and scrolls the window to display it if it isn't. If
R2=-1 then the icon containing the caret (if if belongs to your task) is
used. R0=2 is the recommended movement type to use.
WimpExt_SubstituteArgs &4638C
-------------------------------
R0 = pointer to template string
R1 = pointer to buffer to hold resulting string
R2 = pointer to string %0
R3 = pointer to string %1
R4 = pointer to string %2
R5 = pointer to string %3
R6 = pointer to string %4
Exit:
R0 = pointer to zero-byte terminator of substituted string
Takes a string of the form 'This is an %0 of the %1 of %2_%3' and substitutes
the given strings when %0,%1,%2,%3 or %4 is encountered. eg:
SYS "WimpExt_SubstituteArgs","This is an %0 of the %1 of %2_%3",q%,"example","use","WimpExt","SubstituteArgs" TO ,string$
would give 'This is an example of the use of WimpExt_SubstituteArgs'. Any
strings not used in the template do not need to have sensible values in the
corresponding register, although you may like to make the register zero, in
which case WimpExtension will fault that string's use. To include a % in the
template, use %%.
WimpExt_RedirectSprites &4638D
-------------------------------
R0 = pointer to sprite area control block, or +1 for Wimp sprite area
R1 = pointer to Wimp_CreateWindow block
Sets the sprite area control block pointer of all the indirected, sprite-only
icons in the CreateWindow block to R0.